/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jogo.Entidade;

import java.awt.Graphics2D;
import java.awt.Rectangle;
import jogo.Elemento;

/**
 *
 * @author IVAN
 */
public class Botao extends Elemento{
    
    private String strTexto;
    //private Rectangle recButom;
    
    public Botao()
    {
        strTexto = "";
        super.setRect( new Rectangle(100, 100, 100, 20));
    }
    
    public Botao(String strText)
    {
        strTexto = strText;
        super.setRect( new Rectangle(100, 100, 100, 20));
    }
    
    public Botao(String strText, int x, int y, int width, int height)
    {
        strTexto = strText;
        super.setRect( new Rectangle(x,y,width,height));        
    }
    
    @Override
     public void desenhar(Graphics2D g) {
        g.drawRect( getRecButom().x, getRecButom().y, getRecButom().width, getRecButom().height );
        g.drawString(getStrTexto(), PosicaoXTexto() , PosicaoYTexto());
    }
     
     public int PosicaoXTexto()
     {         
         return (int)(super.getRect().x - ( strTexto.length() ) + ( super.getRect().width/2 ));
     }
     
     public int PosicaoYTexto()
     {
         return (int)((super.getRect().y) + ( super.getRect().height/2 ));
     }

    /**
     * @return the strTexto
     */
    public String getStrTexto() {
        return strTexto;
    }

    /**
     * @param strTexto the strTexto to set
     */
    public void setStrTexto(String strTexto) {
        this.strTexto = strTexto;
    }

    /**
     * @return the recButom
     */
    public Rectangle getRecButom() {
        return super.getRect();
    }

    /**
     * @param recButom the recButom to set
     */
    public void setRecButom(Rectangle recButom) {
        super.setRect(recButom);
    }
    
}
